import { Component } from "react";
import '../css/descContent.css'
import Export from "../api/exportApi";
export default class DescContent extends Component {
    constructor(props) {
        super();
        this.state = {
            path: '',
            item_id: '',
            name: '',
            audition_link: '',
            category: '',
            price: '',
            description: '',
            sold: '0',
            contact_phone: '',
            contact_qq: '',
            real_name: '',
            id_number: '',
            purchase_method: localStorage.getItem("userId")
        }
    }
    // componentDidUpdate=(prevProps, prevState)=>{
    //     console.log(prevProps);
    //     // console.log(prevState);
    //     this.setState({
    //         item_id:this.props.reviceDesc.item_id,
    //         name:this.props.reviceDesc.name,
    //         audition_link:this.props.reviceDesc.audition_link,
    //         category:this.props.reviceDesc.category,
    //         price:this.props.reviceDesc.price,
    //         description:this.props.reviceDesc.description,
    //         contact_phone:this.props.reviceDesc.contact_phone,
    //         contact_qq:this.props.reviceDesc.contact_qq,
    //         real_name:this.props.reviceDesc.real_name,
    //         purchase_method:this.props.reviceDesc.purchase_method
    //     })
    // }
    componentWillReceiveProps = (nextProps) => {
        this.setState({
            item_id: nextProps.reviceDesc.item_id,
            name: nextProps.reviceDesc.name,
            audition_link: nextProps.reviceDesc.audition_link,
            category: nextProps.reviceDesc.category,
            price: nextProps.reviceDesc.price,
            description: nextProps.reviceDesc.description,
            contact_phone: nextProps.reviceDesc.contact_phone,
            contact_qq: nextProps.reviceDesc.contact_qq,
            real_name: nextProps.reviceDesc.real_name,
            purchase_method: nextProps.reviceDesc.purchase_method
        })
    }
    render() {
        return (
            <>
                <div className="descContent">
                    <ul>
                        <li>音乐版权编号: {this.state.item_id}</li>
                        <li>音乐名称: {this.state.name}</li>
                        <li>音乐试听链接: {this.state.audition_link}</li>
                        <li>歌曲类别: {this.state.category}</li>
                        <li>出售价格: {this.state.price}</li>
                        <li>歌曲的描述: {this.state.description}</li>
                        <li>联系电话: {this.state.contact_phone}</li>
                        <li>QQ邮箱: {this.state.contact_qq}</li>
                        <li>发布者真实姓名: {this.state.real_name}</li>
                        <li>发布人（匿名）: {this.state.purchase_method}</li>
                    </ul>
                </div>
            </>
        )
    }
}